I have made my program using Visual Studio.
I would like a TextBox to display the contents of file, but when the contents of file reaches hundreds of megabytes in size, a SystemOutOfMemoryException message appears.
How many bytes can fit into a textbox? So that I can limit the size of the data I read from the file.
Sumit Kesarwani
23-Sep-2013This sounds like a memory problem not a textbox problem which should have effectively unlimited capacity - max size of string = 2GB.
A dirty way is to catch the OOM exception and try again with half the size or so. Perhaps you can break it into smaller sections and store them in a temporary file to be loaded on demand.
If it's a really demanding application you can also target x64 or AnyCPU to get access to more memory on 64 bit Windows.